package com.zycfc.zsf.boot.serializer.hessian;

import java.lang.ref.*;
import com.caucho.hessian.io.*;

public class HessionSoftReferenceSerializerFactory extends AbstractSerializerFactory
{
    private final SoftReferenceSerializer beanSerializer;
    private final SoftReferenceDeserializer beanDeserializer;
    
    public HessionSoftReferenceSerializerFactory() {
        this.beanSerializer = new SoftReferenceSerializer();
        this.beanDeserializer = new SoftReferenceDeserializer();
    }
    
    public Serializer getSerializer(final Class cl) throws HessianProtocolException {
        if (SoftReference.class.isAssignableFrom(cl)) {
            return (Serializer)this.beanSerializer;
        }
        return null;
    }
    
    public Deserializer getDeserializer(final Class cl) throws HessianProtocolException {
        if (SoftReference.class.isAssignableFrom(cl)) {
            return (Deserializer)this.beanDeserializer;
        }
        return null;
    }
}
